package com.jservice.api.service.smk;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.jservice.api.dto.Request;
import com.jservice.api.dto.Response;
import com.jservice.api.dto.ResponseHeader;
import com.jservice.api.service.BaseService;
import com.jservice.api.service.IService;
import com.jservice.model.SmkNews;
import org.springframework.stereotype.Service;

/**
 * Smk0011 - 首页 资讯
 *
 * @Author cwledit
 * @DATE 2017/6/17.
 */
@Service("smk0011")
public class Smk0011 extends BaseService implements IService{
    @Override
    public Response excute(Request request, Response response, ResponseHeader header, String method) throws Exception {

        String sql = "select sn.icon_url, sn.title,sn.sub_title, sn.id from "+ SmkNews.TABLE_NAME+" sn where sn.status = 'ONLINE' order by orders desc," +
                " create_date desc";
        Record record = Db.findFirst(sql);
        return renderSUC(record,response,header);
    }
}
